<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no" />
  <title>利用flex实现自适应</title>
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
</head>
<style>
  #flex {
    display: flex;
    background-color: skyblue;
    height: 100px;
    line-height: 100px;
  }

  #left,
  .right {
    width: 200px;
  }

  #center {
    background: pink;
    /*flex:1*/
    /*等价于*/
    flex-grow: 1;
    text-align: center;
  }
</style>


<body>
  <div id="flex">
    <div id="left">我在左边,width: 200px;</div>
    <div id="center">我在中间，自适应</div>
    <div class="right">我在右边，width：200px</div>
  </div>
</body>

</html>